<?php
namespace app\api\controller\datascreen;

use app\api\controller\Base;
use app\common\model\company\Company;
use app\common\model\orderhawa\Hawa;
use app\common\model\orderhawa\HawaList;
use app\common\model\orderreceipt\Receipt;
use app\common\model\orderreceipt\ReceiptList;
use app\api\controller\mytool\Setting;
use think\facade\Request;
use Firebase\JWT\JWT;

class Erecord extends Base
{
    /**
     * 产生jwt加密串，参考session
     */
    public function initialize()
    {
        parent::initialize();
    }

    /**
     * 获取订单详情
     *  危废名称    危废类别    危废来源    特性  形态  接收量 接收时间    存放区域
     * @return [type] [description]
     */
    public function getlist()
    {
        // self::is_login();
        $visible=['listinfo'=>['HawaListId','TransitDrvierName','TransitBrandNumber','receiptinfo'=>['WarehouseTime','wareinfo'=>['Name']],'companyinfo'=>['Name'],'goodinfo'=>['OrderNumber','Features']],'ReceiveWeight','areainfo'=>['Name','GroupName'],'ObjectState','GoodName'];
        $id  = HawaList::where('State', HawaList::STATEOK)->order('ReceiptListId desc')->limit(100)->column('HawaListId');
        $data = Hawa::where('HawaListId','in',$id)->with(['goodinfo','areainfo','listinfo'=>['receiptinfo'=>['wareinfo'],'companyinfo']])->visible($visible)->select();
        return myok($data);
    }

   
    /**
     * 大屏检测登陆逻辑
     * @return boolean [description]
     */
    public static function is_login()
    {
        $p  = Request::header('token');
        if(empty($p)){
        	$p = '';
        }
        $sb = Setting::login_screen_password($p);
        if (!$sb) {
            moerr('请输入密码', '', 'relogin');
        }
    }
}
